<?php 
require_once(CMS_VENDORS_PATH.'giga_action.php');
class Sitemap extends AppModel
{
	var $name = 'Sitemap';
	
	var $useTable = false;
	
	function getActions($query, $params)
	{
		return $this->{'__'.$query}($params);
	}
	
	function __level($no)
	{
		$actions = array();
		
		// @todo Remove the temporary content below
		$this->pages = array();
		$homepage = new GigaAction(
			'home', __('Homepage'), array('controller' => 'listings', 'action' => 'home')
		);
		
		$category_pages = new GigaAction(
			'categorypages', 
			__('Category Pages'), 
			array(
				'controller' => 'listings', 
				'action' => 'index',
				'params' => array(
					'pass' => array('category'),
					'named' => array('category' => '[[categorySlug]]')
				)
			)
		);
		
		$listing_pages = new GigaAction(
			'listingpages', 
			__('Listing Pages'), 
			array(
				'controller' => 'listings', 
				'action' => 'view',
			)
		);
		$profile_pages = new GigaAction(
			'profilepages', 
			__('User Profile Pages'), 
			array(
				'controller' => 'users', 
				'action' => 'profile',
			)
		);
		
		$category_pages->setCombinations('categorySlug', cri('ListCategory')->getVisibilityOptions());
		$category_pages->setLabel('categorySlug', __('Selected Categories'));
		callHooks("GetSiteMapPages",'.+',$this);
		$pages = compact('homepage','category_pages','listing_pages','profile_pages','advancesSearchPages','listingIndexPages');
		if(isset($this->pages) && is_array($this->pages))
		{
			$pages = am($pages,$this->pages);
		}
		$pageIds = array();
		foreach($pages as $pageName => $pageObject)
		{
			$pageIds[] = $pageObject->id;
		}
		return $pageIds;
	}
}

?>